﻿using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

using Mystery.SharePoint;

namespace Magical.Collaboration.ControlTemplates.Magical.Collaboration
{
    public partial class ProjectMetadataControl : UserControl, ISiteMetadataControl
    {
        ProjectMetadata _metadata;

        void ISiteMetadataControl.UpdateControls(SiteMetadata metadata)
        {
            _metadata = metadata as ProjectMetadata;
            if (_metadata == null) throw new InvalidCastException("A ProjectMetadata object was expected");

            this.ProjectNumberTextBox.Text = _metadata.ProjectNumber;
        }

        void ISiteMetadataControl.UpdateMetadata(SiteMetadata metadata)
        {
            _metadata = metadata as ProjectMetadata;
            if (_metadata == null) throw new InvalidCastException("A ProjectMetadata object was expected");

            _metadata.ProjectNumber = this.ProjectNumberTextBox.Text;
        }   
    }
}
